package com.csdig.cms.service.impl;

import java.util.Set;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Caching;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.stereotype.Service;

//@Service("cacheService")
public class CacheService {

	private static final Logger logger = Logger.getLogger(CacheService.class);

//	@Autowired
	private RedisCacheManager cacheManager;

	/*@Caching(evict = { @CacheEvict(value = { "com.csdig.cms.dao.CmsSettingDAO.findAllFromCache" }, allEntries = true),
			@CacheEvict(value = { "com.csdig.cms.dao.cache.ChannelCacheDAO.findByPIdFromCache" }, allEntries = true),
			@CacheEvict(value = { "com.csdig.cms.dao.cache.ChannelCacheDAO.findByCondiFromCache" }, allEntries = true),
			@CacheEvict(value = { "com.csdig.cms.dao.cache.ChannelCacheDAO.findByIdFromCache" }, allEntries = true)})*/
	public void clearCache() {
		Set<String> set = (Set<String>) cacheManager.getCacheNames();
		for (String o : set) {
			System.out.println(o);
		}
		logger.info("all of system's cache were cleared !");
	}
}
